package com.study.echarts.mapper;

import com.study.echarts.domain.DeptUserCount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.PropertyValues;

import java.util.List;
import java.util.Map;

@Mapper
public interface DeptUserMapper {

    @Select("SELECT d.dept_name AS deptName, COUNT(u.user_id) AS userCount " +
            "FROM sys_user u " +
            "JOIN sys_dept d ON u.dept_id = d.dept_id " +
            "GROUP BY d.dept_name")
    List<DeptUserCount> selectDeptUserCounts();

    @Select("SELECT title, CAST(COUNT(user_id) AS SIGNED) AS count FROM sys_teacher GROUP BY title")
    List<Map<String, Object>> selectPositionDistribution();
    @Select("SELECT c.course_name AS subject, s.score FROM sys_score s JOIN sys_course c ON s.course_id = c.course_id GROUP BY c.course_name, s.score")
    List<Map<String, Object>> selectScoreDistribution();


}
